package demo4;

public class Test {

    public static void eatFunc(Animal animal) {
        animal.eat();
    }

    public static void main(String[] args) {

        Bird bird = new Bird("愤怒的小鸟",6);

        Dog dog = new Dog("旺财",3);

        eatFunc(bird);

        System.out.println("========");

        eatFunc(dog);
    }


    public static void main6(String[] args) {
        Animal animal = new Bird("愤怒的小鸟",6);
        Bird bird = (Bird)animal;
        bird.fly();

        System.out.println("========");

        Animal animal2 = new Dog("旺财",3);
        if(animal2 instanceof  Bird){
            Bird bird2 = (Bird)animal2;
            bird2.fly();
            System.out.println("animal2 instanceof  Bird");
        }else{
            System.out.println("!animal2 instanceof  Bird");
        }

    }





    public static int add(int a,int b) {
        return a+b;
    }

    public static int add(int a,int b,int c) {
        return a+b+c;
    }

    public static void main5(String[] args) {
        System.out.println(add(1, 3));
        System.out.println(add(1, 3, 5));
    }




    public static void main4(String[] args) {
        Animal animal = new Dog("xiao",7);
        animal.eat();
    }
    


    public static void main3(String[] args) {
//        Dog dog = new Dog("恭喜",3);
//        dog.eat();

        Animal animal = new Dog("xiao",7);
        animal.eat();
        //animal.bark();
    }




    public static void main2(String[] args) {
//        Dog dog = new Dog("恭喜",3);
//        Animal animal = new Animal("www",10);
//        animal = dog;

        //Animal animal = new Dog("kk",9);
        Dog dog = new Dog("恭喜",3);
        test1(dog);
    }

    public Animal test2() {
        return new Dog("wangcai",4);
    }

    public Animal test3() {
        return new Cat("miaomiaop",5);
    }

    public static void test1(Animal animal) {

    }





    public static void main1(String[] args) {
        Dog dog = new Dog("恭喜",3);
//        dog.eat();
//        dog.bark();
        System.out.println(dog);
        Cat cat = new Cat("发财",4);
//        cat.eat();
//        cat.mew();
        System.out.println(cat);
    }
}
